/**
 * 
 */
package qualification2010;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Coddy created on 2010-5-8
 * 
 */
public class FairWarning
{
	static String currentInput = "B-small-attempt2.in";
	static String currentOutput = "B-small-attempt2.out";

	// static String currentInput = "input.in";
	// static String currentOutput = "output.out";

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		try
		{
			// input
			BufferedReader bf = new BufferedReader(new FileReader(currentInput));
			BufferedWriter bw = new BufferedWriter(
					new FileWriter(currentOutput));
			int temp = Integer.parseInt(bf.readLine());
			for (int testcase = 0; testcase < temp; testcase++)
			{
				// input
				BigInteger result = new BigInteger("0");
				String line = bf.readLine();

				StringTokenizer tokenizer = new StringTokenizer(line);
				int n = 0;
				if (tokenizer.hasMoreElements())
				{
					n = Integer.parseInt((String) tokenizer.nextElement());
				}
				BigInteger[] t = new BigInteger[n];
				int index = 0;
				while (tokenizer.hasMoreElements())
				{
					t[index++] = new BigInteger((String) tokenizer
							.nextElement());
				}

				// handle
				Arrays.sort(t);
				BigInteger minPub = GcdN(t, t.length);
				// System.out.println(minPub);

				if (minPub.equals(t[0])) // 已经能整除
				{
					result = new BigInteger("0");
				} else
				{
					BigInteger[] t2 = new BigInteger[n - 1];
					for (int i = 0; i < t2.length; i++)
					{
						t2[i] = t[i + 1].subtract(t[0]);
						System.out.println("t2[" + i + "]:" + t2[i]);
					}
					minPub = GcdN(t2, t2.length);
					System.out.println("minPub:" + minPub);
					while (minPub.compareTo(t[0]) < 0)
					{
						minPub = minPub.add(minPub);
						System.out.println(t[0]);
						System.out.println(minPub);
					}

					result = minPub.subtract(t[0]);
				}

				System.out.println("Case #" + (testcase + 1) + ": " + result);
				bw.write("Case #" + (testcase + 1) + ": " + result);
				bw.write("\n");
			}
			bw.flush();
		} catch (Exception e)
		{
			// TODO: handle exception
			e.printStackTrace();
		}
		System.out.println("All done");
	}

	public static BigInteger getNumThree(BigInteger m, BigInteger n)
	{
		BigInteger num = new BigInteger("1");
		BigInteger zero = new BigInteger("0");
		while (num.compareTo(zero) > 0)
		{
			num = m.mod(n);
			m = n;
			n = num;
		}
		return m;
	}

	// N个数的最大公约数
	public static BigInteger GcdN(BigInteger[] digits, int length)
	{
		if (1 == length)
			return digits[0];
		else
			return Gcd(digits[length - 1], GcdN(digits, length - 1));
	}

	// 两个数的最大公约数
	public static BigInteger Gcd(BigInteger a, BigInteger b)
	{
		final BigInteger zero = new BigInteger("0");
		if (b.equals(zero))
			return a;
		else
			return Gcd(b, a.mod(b));
	}
}
